package demo1;

public class Student {

    public static int count = 100;
    private int age = 100;//实例成员变量
    private String name;


    {
        age = 9;
        System.out.println("实例代码块被执行了");
    }
    static{
        System.out.println("静态代码块被执行了");
    }


    public Student() {
        System.out.println("构造代码块被执行了");
    }

    public Student(int age, String name) {
        this.age = age;
        this.name = name;
        System.out.println("构造代码块执行了");

    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void sleep(){
        System.out.println(this.name + "在睡觉");
    }

    public static void eat(){
        System.out.println("在吃饭");
    }

    public static void testStatic(){
        System.out.println("static方法执行了");

    }
    public void testFunc(){
        System.out.println("非静态方法执行了");
        testStatic();
    }

}
